using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;

namespace Phoenix.Xna.Framework.ContentPipeline.Models
{
    [ContentTypeWriter]
    public class SkinnedModelMaterialWriter : ContentTypeWriter<SkinnedModelMaterialContent>
    {
        protected override void Write(ContentWriter output, SkinnedModelMaterialContent value)
        {
            output.Write(value.EmissiveColor);
            output.Write(value.DiffuseColor);
            output.Write(value.SpecularColor);
            output.Write(value.SpecularPower);
            output.Write(value.IsDiffusedMapped);
            output.Write(value.IsNormalMapped);
            output.Write(value.IsSpecularMappped);
            output.WriteObject<ExternalReference<TextureContent>>(value.DiffuseMapContent);
            output.WriteObject<ExternalReference<TextureContent>>(value.NormalMapContent);
            output.WriteObject<ExternalReference<TextureContent>>(value.SpecularMapContent);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(SkinnedModelBasicEffectReader).AssemblyQualifiedName;
        }
    }
}